#include"SystemHead.h"

int main()
{
    key_t key=ftok("./",101);
    if(key<0)
    {
        perror("fork:");
        return -1;
    }
    int SHmID=shmget(key,1024,IPC_CREAT|0777);
    if(SHmID<0)
    {
        perror("SHmID:");
        return -1;

    }
    printf("shmid: %d\n",SHmID);
    void *text=shmat(SHmID,NULL,0);
    if(text==(void *)-1)
    {
        perror("shmat:");
        return -1;
    }
    strcpy(text,"helloword\n");
    if(shmdt(text)==-1)
    {
        perror("shmdt:");
        return -1;
    }
    return 0;
}
